﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ef_core_2025_learn.Migrations
{
    /// <inheritdoc />
    public partial class WorkItemsState修改表名 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_WorkItems_WorkItemsStates_StateId",
                table: "WorkItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_WorkItemsStates",
                table: "WorkItemsStates");

            migrationBuilder.RenameTable(
                name: "WorkItemsStates",
                newName: "work_items_State");

            migrationBuilder.AddPrimaryKey(
                name: "PK_work_items_State",
                table: "work_items_State",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_WorkItems_work_items_State_StateId",
                table: "WorkItems",
                column: "StateId",
                principalTable: "work_items_State",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_WorkItems_work_items_State_StateId",
                table: "WorkItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_work_items_State",
                table: "work_items_State");

            migrationBuilder.RenameTable(
                name: "work_items_State",
                newName: "WorkItemsStates");

            migrationBuilder.AddPrimaryKey(
                name: "PK_WorkItemsStates",
                table: "WorkItemsStates",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_WorkItems_WorkItemsStates_StateId",
                table: "WorkItems",
                column: "StateId",
                principalTable: "WorkItemsStates",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
